package com.ssmTmp.api.exception;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * hz
 */
public class TestException extends RuntimeException {

    public TestException(String message, HttpServletResponse response) {
        test(message, response);
    }

    public void test(String message, HttpServletResponse httpServletResponse) {
        try {
            httpServletResponse.setCharacterEncoding("utf-8");
            PrintWriter out = httpServletResponse.getWriter();
            httpServletResponse.setContentType("application/json; charset=utf-8");
            out.write(message);
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
